using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Entity;
using DataAccess;
namespace Business
{
    public class JobPostingsAuditBusiness
    {
        public DataTable GetJobPostingsAudit()
        {
            DataTable dt = new DataTable();
            string sql = "SELECT * FROM JobPostingsAudit";
            dt = DA.GetDataTable(sql);
            return dt;
        }

        public int AddJobPostingsAudit(JobPostingsAuditEntity jobPostingsAudit)
        {
            int i = 0;
            string sql = "INSERT into [dbo].[JobPostingsAudit] VALUES (@JobPostingID, @CompanyID, @JobTitle, @JobDescription, @JobLocation, @JobType, @JobCategory, @JobStatus, @JobPostDate, @JobCloseDate, @JobAuditDate, @JobAuditStatus)";
            string[] paras = { "@JobPostingID", "@CompanyID", "@JobTitle", "@JobDescription", "@JobLocation", "@JobType", "@JobCategory", "@JobStatus", "@JobPostDate", "@JobCloseDate", "@JobAuditDate", "@JobAuditStatus" };
            object[] values = { jobPostingsAudit.JobPostingID, jobPostingsAudit.CompanyID, jobPostingsAudit.JobTitle, jobPostingsAudit.JobDescription, jobPostingsAudit.JobLocation, jobPostingsAudit.JobType, jobPostingsAudit.JobCategory, jobPostingsAudit.JobStatus, jobPostingsAudit.JobPostDate, jobPostingsAudit.JobCloseDate, jobPostingsAudit.JobAuditDate, jobPostingsAudit.JobAuditStatus };
            i = DA.ExecuteNonQuery(sql, commandType.Text, parameters, values);
            return i;
        }

        public int UpdateJobPostingsAudit(JobPostingsAuditEntity jobPostingsAudit)
        {
            int i = 0;
            string sql = "UPDATE [dbo].[JobPostingsAudit] SET JobPostingID = @JobPostingID, CompanyID = @CompanyID, JobTitle = @JobTitle, JobDescription = @JobDescription, JobLocation = @JobLocation, JobType = @JobType, JobCategory = @JobCategory, JobStatus = @JobStatus, JobPostDate = @JobPostDate, JobCloseDate = @JobCloseDate, JobAuditDate = @JobAuditDate, JobAuditStatus = @JobAuditStatus WHERE JobAuditID = @JobAuditID";
            string[] paras = { "@JobPostingID", "@CompanyID", "@JobTitle", "@JobDescription", "@JobLocation", "@JobType", "@JobCategory", "@JobStatus", "@JobPostDate", "@JobCloseDate", "@JobAuditDate", "@JobAuditStatus", "@JobAuditID" };
            object[] values = { jobPostingsAudit.JobPostingID, jobPostingsAudit.CompanyID, jobPostingsAudit.JobTitle, jobPostingsAudit.JobDescription, jobPostingsAudit.JobLocation, jobPostingsAudit.JobType, jobPostingsAudit.JobCategory, jobPostingsAudit.JobStatus, jobPostingsAudit.JobPostDate, jobPostingsAudit.JobCloseDate, jobPostingsAudit.JobAuditDate, jobPostingsAudit.JobAuditStatus, jobPostingsAudit.JobAuditID };
            i = DA.ExecuteNonQuery(sql, commandType.Text, parameters, values);
            return i;
        }

        public int DeleteJobPostingsAudit(int JobAuditID)
        {
            int i = 0;
            string sql = "DELETE FROM [dbo].[JobPostingsAudit] WHERE JobAuditID = @JobAuditID";
            string[] paras = { "@JobAuditID" };
            object[] values = { JobAuditID };
            i = DA.ExecuteNonQuery(sql, commandType.Text, parameters, values);
            return i;
        }

        public DataTable GetJobPostingsAudit(int JobAuditID)
        {
            DataTable dt = new DataTable();
            string sql = "SELECT * FROM JobPostingsAudit WHERE JobAuditID = @JobAuditID";
            string[] paras = { "@JobAuditID" };
            object[] values = { JobAuditID };
            dt = DA.GetDataTable(sql, commandType.Text, parameters, values);
            return dt;
        }

        public DataTable GetJobPostingsAuditByJobPostingID(int JobPostingID)
        {
            DataTable dt = new DataTable();
            string sql = "SELECT * FROM JobPostingsAudit WHERE JobPostingID = @JobPostingID";
            string[] paras = { "@JobPostingID" };
            object[] values = { JobPostingID };
            dt = DA.GetDataTable(sql, commandType.Text, parameters, values);
            return dt;
        }
    }
}
